#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 10;

struct node {
	int l, r;
}a[N];

bool cmp(node x, node y) {
	return x.l - x.r < y.l - y.r;
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin >> n >> k;
	for (int i = 1; i <= n; i++) cin >> a[i].l;
	for (int i = 1; i <= n; i++) cin >> a[i].r;
	sort(a + 1, a + n + 1, cmp);
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i].l < a[i].r && k>0) {
			ans += a[i].r;
			k--;
		}
		else {
			ans += a[i].l;
		}
	}
	cout << ans << '\n';
}